Materials for the AFEC-X 2020::XTBG. An introduction for modeling autocorrelaition using R.

Objectives

Twittter Github Email

Course materials for 2020-11-2 AFEC at XTBG.

Prerequisites

install.packages("spdep")
library(tidyverse)
library(spdep)

Spatial autocorrelaiton

2D

ggplot(dat, aes(x = x, y = y, fill = hab)) +
  geom_raster()

dat2 <- dat %>%
#  mutate(hab_dummy = ifelse(hab == "valley", 0, 1)) %>%
  mutate(trait = rnorm(nrow(.), mu, 0.3)) # based on z 

dat2 %>%
  ggplot(., aes(x = hab, y = trait, col = hab)) +
  geom_violin() +
  geom_jitter(width = 0.2)

\[ Y = X \beta + \rho W (Y - X \beta) + \epsilon \]

def

Placeholder

What is autocorrelation?

Placeholder

Simple correlation

One dimensional autocorrelation

Two dimensional autocorrelation

Likelihood methods

Placeholder

Likelihood

Analytical approaches

Simulation approaches

Linear models (LMs)

Generalized Linear models (GLMs)

Generalized Linear mixed models (GLMMs)

Independent errors

Dependent errors